﻿@model Bricks.Site.Models.DBViewModel.Contract.VMContractInfo

@{
    ViewBag.Title = "PreviewContractInfo";
    Layout = "~/Views/Shared/_UserPage.cshtml";
}
<script type="text/javascript" charset="utf-8" src="/Res/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/Res/ueditor/ueditor.all.js"> </script>
<script type="text/javascript" charset="utf-8" src="/Res/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
    $(function () {
        $('#estimateDataGrid').datagrid({
            url: '/ContractInfo/GetConstructionContractEstimateList?contractID=' + $('#hID').val(),
            nowrap: true,
            autoRowHeight: false,
            striped: true,
            collapsible: true,
            pagination: true,
            pageSize: 20,
            rownumbers: true,
            remoteSort: false,
            idField: 'ID',
            singleSelect: true,
            columns: [
                     [
                        { title: '', field: 'ID', hidden: true },
                        { title: '', field: 'Type', hidden: true },
                        { title: '支付时间', field: 'EndDate', width: 70, sortable: true, rowspan: 3 },
                        { title: '支付款项', field: 'ContractStages', width: 65, sortable: true, rowspan: 3 },
                        { title: '支付金额', field: '', width: 300, sortable: true, colspan: 3, rowspan: 2 },
                        { title: '业主扣款', field: '', width: 1000, sortable: true, colspan: 10 },
                        { title: '本期实际支付', field: 'ActualPayment', width: 115, sortable: true, rowspan: 3 },
                        { title: '本期末累计支付', field: 'CumulativePayment', width: 115, sortable: true, rowspan: 3 }
                     ],
                     [
                        { title: '预付款', field: '', width: 200, sortable: true, colspan: 2 },
                        { title: '税金', field: '', width: 200, sortable: true, colspan: 2 },
                        { title: '保留金', field: '', width: 200, sortable: true, colspan: 2 },
                        { title: '农民工保障金', field: '', width: 200, sortable: true, colspan: 2 },
                        { title: '违约金', field: '', width: 200, sortable: true, colspan: 2 }
                     ],
                     [
                        { title: '合计', field: 'Total', width: 70, sortable: true },
                        { title: '暂列金', field: 'BehindTheGold', width: 70, sortable: true },
                        { title: '专项暂列金', field: 'SpecialBehindTheGold', width: 70, sortable: true },
                        { title: '上期末', field: 'PrepaymentSQM', width: 70, sortable: true },
                        { title: '本期', field: 'PrepaymentBQ', width: 70, sortable: true },
                        { title: '上期末', field: 'TaxSQM', width: 70, sortable: true },
                        { title: '本期', field: 'TaxBQ', width: 70, sortable: true },
                        { title: '上期末', field: 'RetentionMoneySQM', width: 70, sortable: true },
                        { title: '本期', field: 'RetentionMoneyBQ', width: 70, sortable: true },
                        { title: '上期末', field: 'MigrantWorkersProtectionSQM', width: 70, sortable: true },
                        { title: '本期', field: 'MigrantWorkersProtectionBQ', width: 70, sortable: true },
                        { title: '上期末', field: 'PenaltySQM', width: 70, sortable: true },
                        { title: '本期', field: 'PenaltyBQ', width: 70, sortable: true }
                     ]
            ],
            onDblClickRow: function (rowIndex, rowData) {
                if (rowData.Type == 1) {
                    PreviewEstimate(rowData.ID);
                }
            }
        });

        $('#billDataGrid').treegrid({
            url: "/ContractInfo/GetContractBillInfoList?contractID=" + $('#hID').val(),
            nowrap: true,
            autoRowHeight: false,
            singleSelect: true,
            striped: true,
            pagination: false,
            rownumbers: true,
            remoteSort: false,
            idField: 'ID',
            treeField: 'BillCode',
            parentField: 'PID',
            columns: [[
                { title: '清单编号', field: 'BillCode', width: 100 },
                { title: '清单名称', field: 'BillName', width: 180 },
                { title: '单位', field: 'Unit', width: 70 },
                { title: '合同量', field: 'Count', width: 70 },
                { title: '合同价', field: 'Price', width: 70 },
                { title: '合同额', field: 'Money', width: 70 },
                { title: '施工图量', field: 'ConstructionDrawCount', width: 70 },
                { title: '施工图额', field: 'ConstructionDrawMoney', width: 70 },
                { title: '变更后数量', field: 'AlterCount', width: 70 },
                { title: '变更后单价', field: 'AlterPrice', width: 70 },
                { title: '变更后金额', field: 'AlterMoney', width: 70 },
                { title: '已完成量', field: 'FinishCount', width: 70 },
                { title: '已完成额', field: 'FinishMoney', width: 70 },
                { title: '完成占比 %', field: 'FinishProportion', width: 70 }
            ]]
        });
    });

    function PreviewEstimate(contractStagesID) {
        $.ModelDialog({
            title: "预览期次明细",
            href: "/ContractInfo/ConstructionContractEstimateBillList?contractID=" + $('#hID').val() + "&contractStagesID=" + contractStagesID,
            width: 1100, height: 578,
            onLoad: function () { }
        });
    }

</script>

<div class="frombox datagrid-body" style="padding-bottom: 5px;">
    <div class="easyui-layout" style="height:1000px;width:100%">
        <div data-options="region:'north'" style="height: 248px; width: 860px">
            <form id="contractInfo-model" method="post">
                <table class="datagrid-btable" border="0" cellspacing="0" cellpadding="0">
                    <tr class="datagrid-row">
                        <td class="th">
                            <div class="datagrid-cell">单位名称</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="ContractUnitName" class="easyui-textbox" value="@Model.ContractUnitName" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">合同编号</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="ContractCode" class="easyui-textbox" value="@Model.ContractCode" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">合同名称</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="ContractName" class="easyui-textbox" value="@Model.ContractName" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">计划开工日期</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="ScheduledStartDate" class="easyui-textbox" value="@Model.ScheduledStartDate" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">计划完工日期</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="ScheduledEndDate" class="easyui-textbox" value="@Model.ScheduledEndDate" readonly />
                            </div>
                        </td>
                    </tr>
                    <tr class="datagrid-row">
                        <td class="th">
                            <div class="datagrid-cell">项目总工期（天）</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input id="ProjectPeriod" name="ProjectPeriod" class="easyui-textbox" value="@Model.ProjectPeriod" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">开始桩号</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="StartStake" class="easyui-textbox" value="@Model.StartStake" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">结束桩号</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="EndStake" class="easyui-textbox" value="@Model.EndStake" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">合同金额</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="ContractMoney" class="easyui-textbox" value="@Model.ContractMoneyStr" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">施工图金额</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="StartStake" class="easyui-textbox" value="@Model.ConstructionDrawMoneyStr" readonly />
                            </div>
                        </td>
                        
                        
                    </tr>
                    <tr class="datagrid-row">
                        <td class="th">
                            <div class="datagrid-cell">变更增减金额</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="EndStake" class="easyui-textbox" value="@Model.AlterIncreaseOrDecreaseMoneyStr" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">变更后金额</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="AfterAlterMoney" class="easyui-textbox" value="@Model.AfterAlterMoneyStr" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">累计计量金额</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="AccumulativeEstimateMoney" class="easyui-textbox" value="@Model.AccumulativeEstimateMoneyStr" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">累计计量比例</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="AccumulativeEstimateProportion" class="easyui-textbox" value="@Model.AccumulativeEstimateProportionStr" readonly />
                            </div>
                        </td>
                        <td class="rth">
                            <div class="datagrid-cell">对应单位</div>
                        </td>
                        <td class="td">
                            <div class="datagrid-cell">
                                <input name="CorrespondenceUnitName" class="easyui-textbox" value="@Model.CorrespondenceUnitName" readonly />
                            </div>
                        </td>
                    </tr>
                    <tr class="datagrid-row">
                        <td class="th">
                            <div class="datagrid-cell">内容简介</div>
                        </td>
                        <td class="td" colspan="9">
                            <div class="datagrid-cell">
                                <textarea id="ContractContent" name="ContractContent" cols="57" rows="5" style="width:100%;" readonly>@Model.ContractContent</textarea>
                            </div>
                        </td>
                    </tr>
                    <tr class="datagrid-row">
                        <td class="th">
                            <div class="datagrid-cell">附件</div>
                        </td>
                        @*<td class="td" colspan="6">
                                <div class="datagrid-cell">
                                    <textarea name="Attachment" cols="57" rows="5" style="width:670px;" readonly>@Model.Attachment</textarea>
                                </div>
                            </td>*@
                        <td class="td" colspan="6">
                            <div class="datagrid-cell">
                                @*<textarea name="Attachment" cols="57" rows="5" style="width:670px;">@Model.Attachment</textarea>*@
                                <a href='javascript:void(0)' class='easyui-linkbutton' onclick='$.Upload($("#hID").val(), "ContractManagement/AllContractList/Attachment")' data-options='plain:true,iconCls:"icon-blue_lego"'>附件操作</a>
                            </div>
                        </td>
                    </tr>
                </table>
                <input id="hID" name="ID" type="hidden" value="@Model.ID" />
                <input id="hPID" name="PID" type="hidden" value="@Model.PID" />
            </form>
        </div>
        <div data-options="region:'center'" style="height:200px;">
            <table id="estimateDataGrid" title="计量期次" fit="true"></table>
        </div>
        <div data-options="region:'south'" title="清单明细" style="height: 350px;">
            <table id="billDataGrid" fit="true"></table>
        </div>
    </div>
</div>
